package com.alibaba.citrus.ots.sales.plan.functions.salesplan;

import com.alibaba.citrus.ots.common.util.SpringContextUtil;
import com.alibaba.citrus.ots.sales.plan.repository.NotificationConfigRepository;
import com.alibaba.citrus.ots.sales.plan.sdo.NotificationConfigSDO;
import lombok.Getter;
import lombok.Setter;

public class NotificationEntity {
    @Getter
    @Setter
    private NotificationConfigSDO notificationConfigSDO;

    private static NotificationConfigRepository notificationConfigRepository;

    static {
        notificationConfigRepository = SpringContextUtil.getBean(NotificationConfigRepository.class);
    }

    public static NotificationEntity of(NotificationConfigSDO notificationConfigSDO) {
        NotificationEntity entity = new NotificationEntity();
        entity.setNotificationConfigSDO(notificationConfigSDO);
        //this.notificationConfigSDO = notificationConfigSDO;
        return entity;
    }

    public String doCreate() {
        return notificationConfigRepository.save(this.notificationConfigSDO);
    }

    public Boolean doEdit() {
        return notificationConfigRepository.doEdit(this.notificationConfigSDO);
    }



    public Integer doEditNotificationConfigState() {
        return notificationConfigRepository.editNotificationConfig(this.notificationConfigSDO);
    }
}
